import java.math.BigDecimal;

/**
 * @author lichenxi
 * @date 2020/3/31
 */
public class xxdsTest {
    public static void main(String[] args) {

        Double[] doubles = new Double[2];
        doubles[0] = 1.0;
        doubles[1] = 2.0;

        Vector vector = new Vector(doubles);

        doubles[0] = 2.0;
        doubles[1] = 3.0;
        Vector vector1 = new Vector(doubles);
        System.out.println(vector.addVector(vector1));
        vector = vector.mulNumber(3.0);
        System.out.println(vector.subVector(vector1));


        System.out.println(new Vector(new Double[]{3.0,4.0}).scakarVerctor());
        System.out.println(Vector.zeroVector(3));
        System.out.println(new Vector(new Double[]{3.0,4.0}).unitVector().scakarVerctor());
        System.out.println(new Vector(new Double[]{1.0,1.0}).angleVector(new Vector(new Double[]{1.0,-1.0})));

        Matrix matrix = new Matrix(new Double[][]{new Double[]{1.0, 2.0}, new Double[]{3.0, 4.0}});
        System.out.println(matrix.size());
        System.out.println(matrix.getItem(1,1));
        System.out.println(matrix.rowVector(0));
        System.out.println(matrix.colVector(0));
        System.out.println(matrix.subMatrix(matrix));
        System.out.println(Matrix.zero(3,3));
        System.out.println(Matrix.isSquMatrix(matrix));
        System.out.println(matrix.mulVector(new Vector(new Double[]{1.0,2.0})));

        Matrix matrix1 = new Matrix(new Double[][]{new Double[]{1.0, 0.0}, new Double[]{0.0, 1.0}, new Double[]{0.0, 0.0}, new Double[]{1.0, 1.0}});
        Matrix matrix2 = new Matrix(new Double[][]{new Double[]{2.0, 1.0}, new Double[]{-1.0, 2.0}});
        System.out.println(matrix1.mulMatrix(matrix2));


        Vector[] vectors = {new Vector(new Double[]{1.0, 1.0}),
                new Vector(new Double[]{0.0, 0.0}),
                new Vector(new Double[]{1.0, 0.0}),
                new Vector(new Double[]{0.0, 1.0})};


        Matrix.getIdentity(3).printMatrix();


        new LinearSystem(new Matrix(new Double[][]{
                new Double[]{1.0,2.0,3.0},
                new Double[]{4.0,5.0,6.0},
                new Double[]{7.0,8.0,9.0}}),
                new Vector(new Double[]{1.0,2.0,3.0})).abMatrix.printMatrix();

        System.out.println("--------------------------------------------------------");

        new Matrix(new Double[][]{
                new Double[]{-1.0,2.0,3.0,0.0},
                new Double[]{1.0,-4.0,-13.0,0.0},
                new Double[]{-3.0,5.0,4.0,0.0}}).gaussJordanElimination().proAcc(2,BigDecimal.ROUND_HALF_UP).printMatrix();

        System.out.println("--------------------------------------------------------");
        new Matrix(new Double[][]{
                new Double[]{1.0,2.0},
                new Double[]{3.0,4.0}}).inverseMatrix().proAcc(2,4).printMatrix();

    }
}
